<script setup>
	import {
		ref,
		provide
	} from 'vue';
	import {
		onLaunch,
		onShow,
		onHide
	} from '@dcloudio/uni-app'
	import {
		useUserStore
	} from '@/store/user'

	const statusBarHeight = ref(0)
	provide('statusBarHeight', statusBarHeight)

	onLaunch(() => {
		getStatusHeight()
		
		// 初始化用户状态
		const userStore = useUserStore()
		console.log('App onLaunch - 初始化用户状态')
		console.log('Token:', userStore.token)
		console.log('UserInfo:', userStore.userInfo)
	})
	
	onShow(() => {
		console.log("App onShow");
	})
	
	onHide(() => {
		console.log("App onHide");
	})

	const getStatusHeight = () => {
		uni.getSystemInfo({
			success: (result) => {
				console.log(result);
				statusBarHeight.value = result.statusBarHeight
			}
		})
	}
</script>

<style lang="scss">
	@import 'uview-plus/index.scss';
</style>